﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

using IEQ_Superintendencia.Services.Persistence;
using IEQ_Superintendencia.Domain.Entity;

namespace IEQ_Superintendencia.Domain.Control
{
    class ControlPastor
    {

        public static bool Atualizar(Pastor _pa)
        {
            if (DAOPastor.Inserir(_pa))
                return true;
            else
                return false;

        }

        public static bool Atualizar(Pastor _pa, ref int _pastor_id)
        {
            if (DAOPastor.Inserir(_pa))
            {
                _pastor_id = DAOPastor.GetPastorID();
                return true;
            }
            else
            {
                _pastor_id = 0;
                return false;
            }
        }

        public static bool Incluir(Pastor _objPastor)
        {

            if (DAOPastor.Inserir(_objPastor))
                return true;
            else
                return false;
        }

        public static DataSet Select()
        {
            DataSet dsPastor = null;
            dsIEQSuper.PASTORDataTable dtPastor = new dsIEQSuper.PASTORDataTable();
            IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter taPastor = new IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter();
            
            if ((taPastor.Fill(dtPastor)) > 0)
                dsPastor = dtPastor.DataSet;

            return dsPastor;
        }

        /*public static DataSet Select(int _pastor_id)
        {
            DataSet dsPastor = null;

            dsPastor = DAOPastor.Select(_pastor_id);

            return dsPastor;
        }*/

        public static DataSet SelectByPastorID(int _pastor_id)
        {
            DataSet dsPastor = null;
            dsIEQSuper.PASTORDataTable dtPastor = new dsIEQSuper.PASTORDataTable();
            IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter taPastor = new IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter();

            if ((taPastor.FillByPastorID(dtPastor, _pastor_id)) > 0)
                dsPastor = dtPastor.DataSet;

            return dsPastor;
        }

        public static bool Update(int _pastor_id)
        {
            IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter taPastor = new IEQ_Superintendencia.Services.Persistence.dsIEQSuperTableAdapters.PASTORTableAdapter();

            return true;
        }

    }
}
